package com.yf.catcafe.service.impl;

import com.yf.catcafe.mapper.GoodsMapper;
import com.yf.catcafe.pojo.dto.CatDto;
import com.yf.catcafe.pojo.enity.Cat;
import com.yf.catcafe.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {

    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public List<Cat> query(String name, String category) {
        List<Cat> cats=goodsMapper.query(name,category);
        return cats;
    }

    @Override
    public Cat getById(Long id) {
        Cat cat=goodsMapper.getById(id);
        return cat;
    }

    @Override
    public Cat queryByName(String name) {
        Cat cat=goodsMapper.queryByName(name);
        return cat;
    }

    @Override
    public List<Cat> queryByCategory(String category) {
        List<Cat> cats=goodsMapper.queryByCategory(category);
        return cats;
    }

    @Override
    public void add(CatDto catDto) {
        goodsMapper.add(catDto);
    }

    @Override
    public List<Cat> querySeckill() {
        List<Cat> cats=goodsMapper.querySeckill();
        return cats;
    }
}
